package com.maserb.monitor.repository.schoolStudent;

import com.maserb.monitor.entity.card.CardRecordEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Deprecated
@Repository
public interface StudentAttendanceRepository extends JpaSpecificationExecutor<CardRecordEntity>
        , PagingAndSortingRepository<CardRecordEntity, String> {

    @Query(value = "select count(c) from CardRecordEntity c left join c.student s where s.orgId=?1 and c.date=?2")
    Integer countByClazzAndDate(String clazzId, String date);

    @Query(value = "select c from CardRecordEntity c left join c.student s where s.orgId=?1 and c.date=?2")
    List<CardRecordEntity> findByClazzAndDate(String clazzId, String date);
}